package com.ferryc.modules.sys.entity.param;

import javax.validation.constraints.Pattern;

import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.NotBlank;

import com.ferryc.modules.sys.entity.SysRole;
import com.ferryc.commons.entity.DataEntity;
import com.ferryc.constant.ValidatorConstant;

/**
 * 
 * 类名: SysRole <br/>
 * 作用： <br/>
 * 方法： <br/>
 * 创建者: Ferry C <br/>
 * 添加时间: 2017年12月02日 08:44:23 <br/>
 * 
 */
public class SysRoleParam extends DataEntity<SysRoleParam> {
	private static final long serialVersionUID = 1L;

	/** RoleId */
	private String roleId;

	/** 角色标识 */
	@NotBlank(message = ValidatorConstant.ERROR_ROLE)
	@Pattern(regexp = "[a-zA-Z0-9_]*", message = ValidatorConstant.ERROR_ROLE)
	@Length(min = 2, max = 40, message = ValidatorConstant.ERROR_ROLE)
	private String role;

	/** RoleName */
	@NotBlank(message = ValidatorConstant.ERROR_ROLE_NAME)
	@Length(min = 2, max = 40, message = ValidatorConstant.ERROR_ROLE_NAME)
	private String roleName;

	@NotBlank(message = ValidatorConstant.ERROR_ROLE_PERMISSION)
	private String permissionIds;

	public String getRoleId() {
		return this.roleId;
	}

	public void setRoleId(String roleId) {
		this.roleId = roleId;
	}

	public String getRole() {
		return this.role;
	}

	public void setRole(String role) {
		this.role = role;
	}

	public String getRoleName() {
		return this.roleName;
	}

	public void setRoleName(String roleName) {
		this.roleName = roleName;
	}

	public String getPermissionIds() {
		return permissionIds;
	}

	public void setPermissionIds(String permissionIds) {
		this.permissionIds = permissionIds;
	}

	public SysRole toSysRole() {
		SysRole po = new SysRole();
		po.setId(this.id);
		po.setRoleId(this.roleId);
		po.setRole(this.role);
		po.setRoleName(this.roleName);
		po.setCreateBy(this.createBy);
		po.setCreateDate(this.createDate);
		po.setUpdateBy(this.updateBy);
		po.setUpdateDate(this.updateDate);
		po.setRemarks(this.remarks);
		po.setDelFlag(this.delFlag);
		po.setStatus(this.status);
		po.setLimit(this.limit);
		po.setOffset(this.offset);
		po.setPermissionIds(this.permissionIds);
		po.setLikeName(this.likeName);
		return po;
	}

}